# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Spanner.V1.Model.MultiplexedSessionPrecommitToken do
  @moduledoc """
  When a read-write transaction is executed on a multiplexed session, this precommit token is sent back to the client as a part of the Transaction message in the BeginTransaction response and also as a part of the ResultSet and PartialResultSet responses.

  ## Attributes

  *   `precommitToken` (*type:* `String.t`, *default:* `nil`) - Opaque precommit token.
  *   `seqNum` (*type:* `integer()`, *default:* `nil`) - An incrementing seq number is generated on every precommit token that is returned. Clients should remember the precommit token with the highest sequence number from the current transaction attempt.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :precommitToken => String.t() | nil,
          :seqNum => integer() | nil
        }

  field(:precommitToken)
  field(:seqNum)
end

defimpl Poison.Decoder, for: GoogleApi.Spanner.V1.Model.MultiplexedSessionPrecommitToken do
  def decode(value, options) do
    GoogleApi.Spanner.V1.Model.MultiplexedSessionPrecommitToken.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Spanner.V1.Model.MultiplexedSessionPrecommitToken do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
